package com.runa.monitor.platinterface.extend.nb.mqtt;

import com.runa.monitor.platinterface.extend.nb.service.NbPlantService;
import com.runa.monitor.platinterface.extend.nb.utils.NewMqttSetUtils;
import com.runa.monitor.platinterface.extend.nb.vo.NewReportDataBaseVo;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class NewMqttUpDataQueue implements Runnable {
    private String appKey;
    private String appSecret;
    private NbPlantService mqttService;
    private NewReportDataBaseVo reportDataBaseVo;

    public NewMqttUpDataQueue(String appKey, String appSecret, NbPlantService mqttService, NewReportDataBaseVo reportDataBaseVo) {
        this.appKey = appKey;
        this.appSecret = appSecret;
        this.mqttService = mqttService;
        this.reportDataBaseVo = reportDataBaseVo;
    }


    @Override
    public void run() {
        if (reportDataBaseVo == null) {
            return;
        }
//        SendCmdConfigVo sendCmdConfigVo = new SendCmdConfigVo();
//        sendCmdConfigVo.setDeviceId(reportDataBaseVo.getDeviceId());
//        sendCmdConfigVo.setProductId(reportDataBaseVo.getProductId());
//        sendCmdConfigVo.setAppKey(appKey);
//        sendCmdConfigVo.setAppSecret(appSecret);
        String productId = reportDataBaseVo.getProductId();
        log.info("小瑞面板productId：{}", NewMqttSetUtils.RUI_PANEL_PRODUCT_ID);
        if (NewMqttSetUtils.RUI_PANEL_PRODUCT_ID.equals(productId)) {
            log.info("小瑞面板上报开始");
//            sendCmdConfigVo.setMasterKey(NewMqttSetUtils.RUI_PANEL_MASTER_KEY);
//            sendCmdConfigVo.setTipMessage("nb-iot小瑞面板");
            mqttService.receiveAEP_Panel(reportDataBaseVo);
        }
    }
}

